{% extends '::base.html.twig' %}

{% block stylesheets %}
		<link rel="stylesheet" href="{{ asset('bundles/showstop/css/base.css') }}" type="text/css" media="all" />
		{% endblock %}

{% block body %}
	{{ parent() }}
	<h1>Update User Status</h1>
		<table border="0" width=850 style='table-layout:fixed'>
			<tr>
				<form method="POST" action="{{ path('_userstatus', {'input': next[4] , 'range': next[2]}) }}">
					<td WIDTH="10%">Search:</td>
					<td WIDTH="20%"><input type="text" name="searchTextBox" /></td>
					<td WIDTH="10%"><input type="submit" value="Search" /></td>
				</form>
				<td> </td>
				<form method="POST" action="{{ path('_userstatus', {'input': next[4] , 'range': next[2]}) }}">
					<td WIDTH="10%">Show:</td>
					<td WIDTH="10%">
						<select name="numberShown">
						{% for number in listOfNumber %}
							{% if ( number != next[2] ) %}
								<option value="{{ number }}">{{ number }}</option>
							{% elseif ( number == next[2] ) %}
								<option value="{{ number }}" selected="selected" >{{ number }}</option>
							{% endif %}
						{% endfor %}
						</select>
					</td>
					<td WIDTH="10%"><input type="submit" value="Show" /></td>
				</form>
			</tr>
		</table> 
		
		<table border="0" width=850 style='table-layout:fixed'>
			<tr>
				<td> </td>
				<td WIDTH="10%">
					<a title="First" href="{{ path('_userstatus', {'input': 0 
						, 'range': next[2]}) }} "> <b><h2> << </b></h2> </a>
				</td>
				<td WIDTH="10%">
					<a title="Previous" href="{{ path('_userstatus', {'input': next[1] 
						, 'range': next[2]}) }} "> <b><h2> < </b></h2> </a></td>
				<td> </td>
				<td WIDTH="10%" >
					<a title="Next" href="{{ path('_userstatus', {'input': next[0] 
						, 'range': next[2]}) }} "> <b><h2> > </b></h2> </a></td>
				<td WIDTH="10%">
					<a title="Last" href="{{ path('_userstatus', {'input': next[3][0].number - next[2] 
						, 'range': next[2]}) }} "> <b><h2> >> </b></h2> </a>
				</td>
				<td> </td>
			</tr>
		</table> 
		
		<table border="1" width=850 class="user-table style='table-layout:fixed;'>
			<thead  class="user-table-head">
				<td WIDTH="20%"><b><p style="text-align: center">User Name</p></b></td>
				<td WIDTH="20%"><b><p style="text-align: center">Name</p></b></td>
				<td WIDTH="30%"><b><p style="text-align: center">Email</p></b></td>
				<td WIDTH="10%"><b><p style="text-align: center">Banned</p></b></td>
				<td WIDTH="10%"><b><p style="text-align: center">Deactive</p></b></td>
				<td WIDTH="10%"><b><p style="text-align: center">Admin</p></b></td>
			</thead>
			<tbody class="user-table-body">
			{% for user in users %}
			<tr>
				<td>{{ user.username }}</td>
				<td>{{ user.firstname}} {{ user.lastname }}</td>
				<td>{{ user.email }}</td>
				<td class="user-table-button">
					{% if ( user.role_id != 4 ) %}
						<form method="POST" action="{{ path('_userstatus', {'input': next[4] , 'range': next[2]}) }}">
							<input type="hidden" name="bannedUser" value="{{ user.id }}" />
							<center><input type="submit" value="Banned" class="grey-button user-table-button"/></center>
						</form>
					{% elseif ( user.role_id == 4 )  %}
						<form method="POST" action="{{ path('_userstatus', {'input': next[4] , 'range': next[2]}) }}">
							<input type="hidden" name="unBannedUser" value="{{ user.id }}" />
							<center><input type="submit" value="UnBanned" class="grey-button user-table-button"/></center>
						</form>
					{% endif %}
				</td>
				<td class="user-table-button">
					{% if ( user.enabled == 'Y' ) %}
						<form method="POST" action="{{ path('_userstatus', {'input': next[4] , 'range': next[2]}) }}">
							<input type="hidden" name="deactivate" value="{{ user.id }}" />
							<center><input type="submit" value="Deactivate" class="grey-button user-table-button"/></center>
						</form>
					{% elseif ( user.enabled == 'N')  %}
						<form method="POST" action="{{ path('_userstatus', {'input': next[4] , 'range': next[2]}) }}">
							<input type="hidden" name="reactivate" value="{{ user.id }}" />
							<center><input type="submit" value="Reactivate" class="grey-button user-table-button"/></center>
						</form>
					{% endif %}
				</td>
				<td class="user-table-button">
					{% if ( user.role_id != 2 ) %}
						<form method="POST" action="{{ path('_userstatus', {'input': next[4] , 'range': next[2]}) }}">
							<input type="hidden" name="admin" value="{{ user.id }}" />
							<center><input type="submit" value="+ Admin" class="grey-button user-table-button"/></center>
						</form>
					{% elseif ( user.role_id == 2 )  %}
						<form method="POST" action="{{ path('_userstatus', {'input': next[4] , 'range': next[2]}) }}">
							<input type="hidden" name="unadmin" value="{{ user.id }}" />
							<center><input type="submit" value="- Admin" class="grey-button user-table-button"/></center>
						</form>
					{% endif %}
				</td>
			</tr>
			{% endfor %}
			</tbody>
		</table> 
	{% endblock %}